#pragma once

#include <Windows.h>

#include "IGameState.h"

#include "BitmapFont.h"

class CSGD_Direct3D;
class CSGD_DirectInput;
class CSGD_TextureManager;
class CSGD_XAudio2;

class IGameState;
class Player;

class Game
{
private:

	IGameState* curState;
	DWORD gameTime;
	int screenHeight;
	int screenWidth;

	int musicVolume;
	int sfxVolume;
	bool notFullscreen;
	bool english;

	Game(void);
	~Game(void);
	Game(const Game&);
	Game& operator=(const Game&);

	void Update(void);
	void Render(void);
	bool Input(void);

	void LoadStrings(HINSTANCE hI);


	// SGD Wrappers
	CSGD_Direct3D*			m_pD3D;
	CSGD_DirectInput*		m_pDI;
	CSGD_TextureManager*	m_pTM;
	CSGD_XAudio2*			m_pXA;

	// Images
	int menuCursorID;

	// Image variables
	CBitmapFont* GroupFont;
	int	FontImageID;

	// Menu Sounds
	int menuMove;
	int menuSelect;
	int menuBack;
	int menuMusic;

	bool playMenuMusic;

	HWND hWnd;


public:
	void ChangeState(IGameState* state);
	void Init(HWND hwnd, HINSTANCE hintance, int width, int height);
	bool Main(void);
	void Shutdown(void);
	static Game* GetInstance(void);

	bool LoadOptions(const char* szFileName);

	int GetScreenWidth(void) {return screenWidth;}
	int GetScreenHeight(void) {return screenHeight;}

	// Options
	int  GetSFXVolume() const	{return sfxVolume;}
	void SetSFXVolume(int s)	{sfxVolume = s;}

	int  GetMusicVolume() const	{return musicVolume;}
	void SetMusicVolume(int m)	{musicVolume = m;}

	bool GetFullscreen(void)	{return notFullscreen;}
	void SetFullScreen(bool on) {notFullscreen = on;}

	bool GetLanguage() const	{return english;}
	void SetLanguage(bool l)	{english = l;}


	int GetMenuCursorID() const		{return menuCursorID;}

	void DrawBitmapFont(const char* szText, int nX, int nY, float fScale, DWORD dwColor)		{GroupFont->Print(szText, nX, nY, fScale, dwColor);}
	void DrawBitmapFontTCHAR(const TCHAR* szText, int nX, int nY, float fScale, DWORD dwColor)	{GroupFont->PrintTCHAR(szText, nX, nY, fScale, dwColor);}

	void SaveGame(int slot, bool deletion = false);

	bool LoadGame(const char* szFileName, int slot);


	// Sounds
	int GetMenuMove() const		{return menuMove;}
	int GetMenuSelect() const	{return menuSelect;}
	int GetMenuBack() const		{return menuBack;}
	int GetMenuMusic() const	{return menuMusic;}

};